package com.zls.commonutil.component;

import android.app.Activity;
import android.app.Application;

import com.zls.commonutil.Lg;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by oop on 2018/4/4.
 */

public class BaseApp extends Application {

    private static BaseApp INSTANCE;

    public static BaseApp getINSTANCE(){
        return INSTANCE;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        INSTANCE = this;

        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                Lg.i("uncaughtException", e.getMessage());
            }
        });

    }

    private List<Activity> allActivity = new ArrayList<>();

    public List<Activity> getAllActivity() {
        return allActivity;
    }

    public void save(Activity activity){
        allActivity.add(activity);
    }

    public void remove(Activity activity){
        allActivity.remove(activity);
    }




}
